Skip to content

Conversation

@gballet
Copy link
Member

@gballet gballet commented Jun 25, 2019

Solidity now supports a function parameter type, which is a function pointer. At the bytecode level, this is a 24-byte digit with the first 20 bytes being the address of the contract and the last 4 being the 4 byte identifier of the function's signature.

This PR enables the support for this function type in Go, by replacing it with [24]byte. It also adds a helper map to easily convert from the 4-byte id to the function name.

This is meant to address #17096

@gballet gballet requested a review from karalabe June 25, 2019 13:47
@gballet gballet force-pushed the abigen-function-callback branch from b30f539 to 8d9db9b Compare June 25, 2019 14:34
They are translated as [24]byte
@gballet gballet added this to the 1.9.0 milestone Jun 27, 2019
Code string `json:"code"`
RuntimeCode string `json:"runtime-code"`
Info ContractInfo `json:"info"`
Hashes map[string]string `json:"hashes"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any need to keep this backwards compatible, or do we assume that ppl always regenerate stuff and there's no need to parse stuff which doesn't have hashes ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is backwards-compatible in the sense that this is a convenience conversion table so that client code can quickly lookup a function name given its hash. Older client code that won't be regenerated will simply have to do the translation themselves.

Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gballet gballet merged commit 6bf5555 into ethereum:master Jul 2, 2019
gzliudan added a commit to gzliudan/XDPoSChain that referenced this pull request Dec 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants